package com.daodway.designpattern.innerclass;
/*规则2:外部类要访问内部类，必须建立内部类对象
 * 前置条件:在外部其它类中访问内部类*/
class Outer2 {
		  private int x = 1;
		  class Inner {
			   public void seeOuter() {
			    System.out.println(x);
			   }
		  }
}
public class Touter{
	public static void main(String[] args){
			Outer.Inner inner = new Outer().new Inner();
			inner.seeOuter();
	 }
	 
}
/*对比：在外部类的非静态方法中访问内部类：Inner in = new Inner();
**在外部类的静态方法中访问内部类：Outer.Inner in = new Outer().new Inner();
**在外部其他类中访问内部类：Outer.Inner in = new Outer().new Inner();
*/